package com.ceadeal.admin.entity;

import javax.persistence.*;

/**
 * 文章
 *
 * @author Westin Yang
 * @date 2017-04-02 21:28:10
 */
@Entity
@Table(name = "cdl_article")
public class Article extends BaseEntity {

    /* 静态常量 */
    // 内容类型
    public static final int CONTENT_TYPE_TEXT       = 0;    // 普通文本
    public static final int CONTENT_TYPE_MARKDOWN   = 1;    // Markdown

    /* 非数据库表的字段映射 */
    @Transient
    private String articleCategoryName;

    /* 数据库表的映射字段 */
    /** 文章分类ID */
    @Column(nullable = false)
    private Long articleCategoryId;

    /** 标题 */
    @Column(nullable = false)
    private String title;

    /** 副标题 */
    @Column
    private String subtitle;

    /** 内容 */
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(nullable = false, columnDefinition = "MEDIUMTEXT")
    private String content;

    /** 内容类型 */
    @Column(nullable = false)
    private int contentType;

    /** 作者ID */
    @Column
    private Long authorId;

    /** 作者名字 */
    @Column
    private String authorName;

    public Long getArticleCategoryId() {
        return articleCategoryId;
    }

    public void setArticleCategoryId(Long articleCategoryId) {
        this.articleCategoryId = articleCategoryId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubtitle() {
        return subtitle;
    }

    public void setSubtitle(String subtitle) {
        this.subtitle = subtitle;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getContentType() {
        return contentType;
    }

    public void setContentType(int contentType) {
        this.contentType = contentType;
    }

    public Long getAuthorId() {
        return authorId;
    }

    public void setAuthorId(Long authorId) {
        this.authorId = authorId;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public String getArticleCategoryName() {
        return articleCategoryName;
    }

    public void setArticleCategoryName(String articleCategoryName) {
        this.articleCategoryName = articleCategoryName;
    }
}
